package com.lucun.es_transaction.controller;

import com.lucun.es_transaction.config.RolePermission;
import com.lucun.es_transaction.entity.Classification;
import com.lucun.es_transaction.service.ClassificationService;
import com.lucun.es_transaction.util.AuthorityUtil;
import com.lucun.es_transaction.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/classification")
public class ClassificationController {
    @Autowired
    private ClassificationService service;

    @RolePermission(role = AuthorityUtil.FIRST)
    @RequestMapping("/insert")//商品分类添加
    public JsonResult<?> insertSelective(@RequestBody Classification classification, HttpServletRequest request){
        return service.insert(classification,request);
    }
    @RolePermission(role = AuthorityUtil.FIRST)
    @RequestMapping("/selectByPrimaryKey")//商品分类查询/id
    public JsonResult<?> selectByPrimaryKey(@RequestBody Classification classification, HttpServletRequest request){
        return service.selectByPrimaryKey(classification,request);
    }
    @RolePermission(role = AuthorityUtil.FIRST)
    @RequestMapping("/updateByPrimaryKey")//商品分类删除
    public JsonResult<?> updateByPrimaryKey(@RequestBody Classification classification, HttpServletRequest request){
        return service.updateByPrimaryKey(classification,request);
    }
    @RolePermission(role = AuthorityUtil.FIRST)
    @RequestMapping("/updateByPrimaryKeySelective")//商品分类信息修改
    public JsonResult<?> updateByPrimaryKeySelective(@RequestBody Classification classification, HttpServletRequest request){
        return service.updateByPrimaryKeySelective(classification,request);
    }
    @RolePermission(role = AuthorityUtil.FIRST)
    @RequestMapping("/deleteByPrimaryKey")//商品分类信息修改
    public JsonResult<?> deleteByPrimaryKey(@RequestBody Classification classification, HttpServletRequest request){
        return service.deleteByPrimaryKey(classification,request);
    }
}
